package com.chengyu.core.controller.callback.logic;

import com.chengyu.core.controller.callback.manager.CallbackFactory;
import com.chengyu.core.exception.ServiceException;
import com.chengyu.core.model.TyOrder;
import com.chengyu.core.service.ty.TyOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service("tyOrderLogic")
public class TyOrderLogic extends CallbackFactory {

    @Autowired
    private TyOrderService orderService;

    @Override
    public void paySus(String orderNo) throws ServiceException {
        orderService.paySus(orderNo);
    }

    @Override
    public void refundSus(String orderNo) {
        TyOrder order = orderService.getOrderByOrderNo(orderNo);
        orderService.cancelAndRefundOrderSus(order);
    }
}
